import requests
import gui
import UpdateWindow
import locker
import LockWindow

VERSION = 10000

def update():
    try:
        # 从URL获取版本号
        response = requests.get("https://gitee.com/zhu-zehang/cross-border-e-commerce-wizard/raw/master/VERSION.txt")
        response.raise_for_status()  # 检查请求是否成功
        remote_version = int(response.text.strip())
        
        # 比较版本号
        if remote_version > VERSION:
            return True
        elif remote_version < VERSION:
            return False
        else:
            return False
    except requests.RequestException:
        return False
    except ValueError:
        return False

if update():
    UpdateWindow.show_update_prompt()

if locker.if_locked():
    LockWindow.main()
    exit()
else:
    login = gui.LoginWindow()
    login.run()
